package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IEngineeringConstructOrderAssignSendView;
import com.cloudsigns.factorymanager2.engineering.model.EngineeringConstructOrderAssignSendModel;
import com.cloudsigns.factorymanager2.engineering.model.IEngineeringConstructOrderAssignSendModel;

/**
 * 工程施工单进行分派
 */
public class EngineeringConstructOrderAssignSendPresenter {
    private IEngineeringConstructOrderAssignSendView view;
    private IEngineeringConstructOrderAssignSendModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public EngineeringConstructOrderAssignSendPresenter(IEngineeringConstructOrderAssignSendView view) {
        this.view = view;
        this.model = new EngineeringConstructOrderAssignSendModel();
    }

    public void engineeringConstructOrderAssignSend() {


        model.engineeringConstructOrderAssignSend(view.getConstructOrderAssignSendList(),view.id(),
                new EngineeringConstructOrderAssignSendModel.OnEngineeringConstructOrderAssignSendListener() {

            @Override
            public void success(final String projectId) {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.successed(projectId);
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void failed(final String desc) {

            }
        });

    }
}
